import { createSlice } from "@reduxjs/toolkit";

// actions: 对象类型, 用于存储 action creator 函数, 函数名字和 reducers 配置选项中 reducer 函数的名字相对应
const { actions, reducer: FilterInfo } = createSlice({
    name: "filterinfo",
    initialState: {
        isFilter:false,
        info:{}
    },
    reducers: {
        // 添加任务
        editFilter(state, action) {
            console.log(action)
            state.isFilter=action.payload.type
            state.info=action.payload?.info?action.payload.info:{}
        },
    },
});
// 导出 action creator 函数, 供组件使用
export const { editFilter } = actions;
// 导出 reducer 函数, 因为在后续的代码中还是要合并 reducer 函数
export default FilterInfo;
